<!DOCTYPE html>






  


<html class="theme-next mist use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<meta name="theme-color" content="#222">



  
  
  <link rel="stylesheet" href="/lib/needsharebutton/needsharebutton.css">




  
  
    
    
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/lib/pace/pace-theme-minimal.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />










  <meta name="baidu-site-verification" content="6hi01gkdPQ" />










  
  
  
  

  
    
    
  

  
    
      
    

    
  

  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Monda:300,300italic,400,400italic,700,700italic|Roboto Slab:300,300italic,400,400italic,700,700italic|Lobster Two:300,300italic,400,400italic,700,700italic|PT Mono:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.2.0" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.ico?v=6.2.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.ico?v=6.2.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.ico?v=6.2.0">


  <link rel="mask-icon" href="/images/logo.ico?v=6.2.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '6.2.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '995B6MOVEJ',
      apiKey: 'cc928ef862522d7631d991ac65f2ec92',
      indexName: 'imwangyu',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="获取当前时间的工具类12345678910package cn.net.wangshifu;import java.text.SimpleDateFormat;public class TimeConvertUtil &amp;#123;    static SimpleDateFormat format = new SimpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss:SSS&quot;);">
<meta name="keywords" content="Spring,Bean">
<meta property="og:type" content="article">
<meta property="og:title" content="Spring Bean的加载过程">
<meta property="og:url" content="http://wyu.space/2017/08/25/Spring Bean的加载过程/index.html">
<meta property="og:site_name" content="Sometimes Naive">
<meta property="og:description" content="获取当前时间的工具类12345678910package cn.net.wangshifu;import java.text.SimpleDateFormat;public class TimeConvertUtil &amp;#123;    static SimpleDateFormat format = new SimpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss:SSS&quot;);">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2018-04-30T16:40:51.018Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Spring Bean的加载过程">
<meta name="twitter:description" content="获取当前时间的工具类12345678910package cn.net.wangshifu;import java.text.SimpleDateFormat;public class TimeConvertUtil &amp;#123;    static SimpleDateFormat format = new SimpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss:SSS&quot;);">



  <link rel="alternate" href="/atom.xml" title="Sometimes Naive" type="application/atom+xml" />




  <link rel="canonical" href="http://wyu.space/2017/08/25/Spring Bean的加载过程/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>Spring Bean的加载过程 | Sometimes Naive</title>
  






  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?405d001d8bd35d058cc9251901c71aa6";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>
	
	<a href="https://github.com/imwangyu"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
	
    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Sometimes Naive</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>




<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br />首页</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br />关于</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />标签</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">
    <a href="/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br />分类</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />归档</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-commonweal">
    <a href="/404.html" rel="section">
      <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br />公益 404</a>
  </li>

      
      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />搜索</a>
        </li>
      
    </ul>
  

  
    

  

  
    <div class="site-search">
      
  
  <div class="algolia-popup popup search-popup">
    <div class="algolia-search">
      <div class="algolia-search-input-icon">
        <i class="fa fa-search"></i>
      </div>
      <div class="algolia-search-input" id="algolia-search-input"></div>
    </div>

    <div class="algolia-results">
      <div id="algolia-stats"></div>
      <div id="algolia-hits"></div>
      <div id="algolia-pagination" class="algolia-pagination"></div>
    </div>

    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
  </div>




    </div>
  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  
    <div class="reading-progress-bar"></div>
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://wyu.space/2017/08/25/Spring Bean的加载过程/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="王宇">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Sometimes Naive">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Spring Bean的加载过程
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2017-08-25 23:10:18" itemprop="dateCreated datePublished" datetime="2017-08-25T23:10:18+08:00">2017-08-25</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2018-05-01 00:40:51" itemprop="dateModified" datetime="2018-05-01T00:40:51+08:00">2018-05-01</time>
              
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/Spring/" itemprop="url" rel="index"><span itemprop="name">Spring</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon"
            >
            <i class="fa fa-eye"></i>
             热度： 
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
			<span>℃</span>
            </span>
          

          
            <div class="post-symbolscount">
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">本文字数：</span>
                
                <span title="本文字数">10k</span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">9 分钟</span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="获取当前时间的工具类"><a href="#获取当前时间的工具类" class="headerlink" title="获取当前时间的工具类"></a>获取当前时间的工具类</h2><figure class="highlight haxe"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">package</span> cn.net.wangshifu;</div><div class="line"></div><div class="line"><span class="keyword">import</span> java.text.SimpleDateFormat;</div><div class="line"></div><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">TimeConvertUtil</span> </span>&#123;</div><div class="line">    <span class="keyword">static</span> SimpleDateFormat format = <span class="keyword">new</span> <span class="type">SimpleDateFormat</span>(<span class="string">"yyyy-MM-dd HH:mm:ss:SSS"</span>);</div><div class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">String</span> getCurrentTime() &#123;</div><div class="line">       <span class="keyword">return</span> format.format(System.currentTimeMillis());</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h2 id="测试Bean"><a href="#测试Bean" class="headerlink" title="测试Bean"></a>测试Bean</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">package</span> cn.net.wangshifu;</div><div class="line"></div><div class="line"><span class="keyword">import</span> org.springframework.beans.factory.DisposableBean;</div><div class="line"><span class="keyword">import</span> org.springframework.beans.factory.InitializingBean;</div><div class="line"><span class="keyword">import</span> javax.annotation.PostConstruct;</div><div class="line"></div><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">TestLoadingOrder</span>  <span class="keyword">implements</span> <span class="title">InitializingBean</span>,<span class="title">DisposableBean</span></span>&#123;</div><div class="line"></div><div class="line">    <span class="keyword">private</span> <span class="keyword">static</span> String test1;</div><div class="line">    <span class="keyword">private</span> String test2;</div><div class="line"></div><div class="line">    <span class="keyword">static</span> &#123;</div><div class="line">        test1 = <span class="string">"static"</span>;</div><div class="line">        System.out.println(TimeConvertUtil.getCurrentTime()+<span class="string">" TestLoadingOrder.static has been executed"</span>);</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> String <span class="title">getTest1</span><span class="params">()</span> </span>&#123;</div><div class="line">        <span class="keyword">return</span> test1;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">setTest1</span><span class="params">(String test1)</span> </span>&#123;</div><div class="line">        TestLoadingOrder.test1 = test1;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getTest2</span><span class="params">()</span> </span>&#123;</div><div class="line">        <span class="keyword">return</span> test2;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setTest2</span><span class="params">(String test2)</span> </span>&#123;</div><div class="line">        <span class="keyword">this</span>.test2 = test2;</div><div class="line">        System.out.println(TimeConvertUtil.getCurrentTime()+<span class="string">" TestLoadingOrder.setTest2 has been executed"</span>);</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">init_method</span><span class="params">()</span> </span>&#123;</div><div class="line">        System.out.println(TimeConvertUtil.getCurrentTime()+<span class="string">" TestLoadingOrder.init_method has been executed"</span>);</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">destroy_method</span><span class="params">()</span> <span class="keyword">throws</span> Exception </span>&#123;</div><div class="line">        System.out.println(TimeConvertUtil.getCurrentTime()+<span class="string">" TestLoadingOrder.destory_method has been executed"</span>);</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    TestLoadingOrder() &#123;</div><div class="line">        System.out.println(TimeConvertUtil.getCurrentTime()+<span class="string">" TestLoadingOrder.construct has been executed"</span>);</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">afterPropertiesSet</span><span class="params">()</span> <span class="keyword">throws</span> Exception </span>&#123;</div><div class="line">        System.out.println(TimeConvertUtil.getCurrentTime()+<span class="string">" TestLoadingOrder.afterProSertiesSet has been executed"</span>);</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="meta">@PostConstruct</span></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">postConstruct</span><span class="params">()</span></span>&#123;</div><div class="line">        System.out.println(TimeConvertUtil.getCurrentTime()+<span class="string">" TestLoadingOrder.postConstruct has been executed"</span>);</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">destroy</span><span class="params">()</span> <span class="keyword">throws</span> Exception </span>&#123;</div><div class="line">        System.out.println(TimeConvertUtil.getCurrentTime()+<span class="string">" TestLoadingOrder.destory has been executed"</span>);</div><div class="line">    &#125;</div><div class="line"></div><div class="line"></div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h2 id="InstantiationAwareBeanPostProcessor的实现类"><a href="#InstantiationAwareBeanPostProcessor的实现类" class="headerlink" title="InstantiationAwareBeanPostProcessor的实现类"></a>InstantiationAwareBeanPostProcessor的实现类</h2><figure class="highlight processing"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">package</span> cn.net.wangshifu;</div><div class="line"></div><div class="line"><span class="keyword">import</span> org.springframework.beans.BeansException;</div><div class="line"><span class="keyword">import</span> org.springframework.beans.PropertyValues;</div><div class="line"><span class="keyword">import</span> org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;</div><div class="line"></div><div class="line"><span class="keyword">import</span> java.beans.PropertyDescriptor;</div><div class="line"></div><div class="line"><span class="keyword">public</span> class MyInstantiationAwareBeanPostProcessor implements InstantiationAwareBeanPostProcessor &#123;</div><div class="line">    <span class="keyword">public</span> <span class="keyword">Object</span> postProcessBeforeInstantiation(Class&lt;?&gt; aClass, <span class="keyword">String</span> s) <span class="keyword">throws</span> BeansException &#123;</div><div class="line">        <span class="keyword">if</span> (aClass == TestLoadingOrder.class) &#123;</div><div class="line">            System.out.<span class="built_in">println</span>(TimeConvertUtil.getCurrentTime()+<span class="string">" InstantiationAwareBeanPostProcessor.postProcessBeforeInstantiation: "</span>+s);</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">return</span> <span class="keyword">null</span>;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="keyword">public</span> <span class="built_in">boolean</span> postProcessAfterInstantiation(<span class="keyword">Object</span> o, <span class="keyword">String</span> s) <span class="keyword">throws</span> BeansException &#123;</div><div class="line">        <span class="keyword">if</span> (o.getClass() == TestLoadingOrder.class) &#123;</div><div class="line">            System.out.<span class="built_in">println</span>(TimeConvertUtil.getCurrentTime()+<span class="string">" InstantiationAwareBeanPostProcessor.postProcessAfterInstantiation: "</span>+s);</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">return</span> <span class="keyword">false</span>;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="keyword">public</span> PropertyValues postProcessPropertyValues(PropertyValues propertyValues, PropertyDescriptor[] propertyDescriptors, <span class="keyword">Object</span> o, <span class="keyword">String</span> s) <span class="keyword">throws</span> BeansException &#123;</div><div class="line">        <span class="keyword">if</span> (o.getClass() == TestLoadingOrder.class) &#123;</div><div class="line">            System.out.<span class="built_in">println</span>(TimeConvertUtil.getCurrentTime()+<span class="string">" InstantiationAwareBeanPostProcessor.postProcessPropertyValues: "</span>+s);</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">return</span> <span class="keyword">null</span>;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="keyword">public</span> <span class="keyword">Object</span> postProcessBeforeInitialization(<span class="keyword">Object</span> o, <span class="keyword">String</span> s) <span class="keyword">throws</span> BeansException &#123;</div><div class="line">        <span class="keyword">if</span> (o.getClass() == TestLoadingOrder.class) &#123;</div><div class="line">            System.out.<span class="built_in">println</span>(TimeConvertUtil.getCurrentTime()+<span class="string">" InstantiationAwareBeanPostProcessor.postProcessBeforeInitialization: "</span>+s);</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">return</span> o;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="keyword">public</span> <span class="keyword">Object</span> postProcessAfterInitialization(<span class="keyword">Object</span> o, <span class="keyword">String</span> s) <span class="keyword">throws</span> BeansException &#123;</div><div class="line">        <span class="keyword">if</span> (o.getClass() == TestLoadingOrder.class) &#123;</div><div class="line">            System.out.<span class="built_in">println</span>(TimeConvertUtil.getCurrentTime()+<span class="string">" InstantiationAwareBeanPostProcessor.postProcessAfterInitialization: "</span>+s);</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">return</span> o;</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h2 id="BeanPostProcessor的实现类"><a href="#BeanPostProcessor的实现类" class="headerlink" title="BeanPostProcessor的实现类"></a>BeanPostProcessor的实现类</h2><figure class="highlight processing"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">package</span> cn.net.wangshifu;</div><div class="line"></div><div class="line"><span class="keyword">import</span> org.springframework.beans.BeansException;</div><div class="line"><span class="keyword">import</span> org.springframework.beans.factory.config.BeanPostProcessor;</div><div class="line"></div><div class="line"><span class="keyword">public</span> class MyBeanPostProcessor implements BeanPostProcessor &#123;</div><div class="line"></div><div class="line">    <span class="keyword">public</span> <span class="keyword">Object</span> postProcessBeforeInitialization(<span class="keyword">Object</span> o, <span class="keyword">String</span> s) <span class="keyword">throws</span> BeansException &#123;</div><div class="line">        <span class="keyword">if</span> (o.getClass()==TestLoadingOrder.class)&#123;</div><div class="line">            System.out.<span class="built_in">println</span>(TimeConvertUtil.getCurrentTime()+<span class="string">" BeanPostProcessor.postProcessBeforeInitialization :"</span> + o.getClass());</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">return</span> o;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    <span class="keyword">public</span> <span class="keyword">Object</span> postProcessAfterInitialization(<span class="keyword">Object</span> o, <span class="keyword">String</span> s) <span class="keyword">throws</span> BeansException &#123;</div><div class="line">        <span class="keyword">if</span> (o.getClass()==TestLoadingOrder.class)&#123;</div><div class="line">            System.out.<span class="built_in">println</span>(TimeConvertUtil.getCurrentTime()+<span class="string">" BeanPostProcessor.postProcessAfterInitialization :"</span> + o.getClass());</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">return</span> o;</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h2 id="BeanFactoryPostProcessor的实现类"><a href="#BeanFactoryPostProcessor的实现类" class="headerlink" title="BeanFactoryPostProcessor的实现类"></a>BeanFactoryPostProcessor的实现类</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">package</span> cn.net.wangshifu;</div><div class="line"></div><div class="line"><span class="keyword">import</span> org.springframework.beans.BeansException;</div><div class="line"><span class="keyword">import</span> org.springframework.beans.factory.config.BeanFactoryPostProcessor;</div><div class="line"><span class="keyword">import</span> org.springframework.beans.factory.config.ConfigurableListableBeanFactory;</div><div class="line"></div><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">MyBeanFactoryPostProcessor</span> <span class="keyword">implements</span> <span class="title">BeanFactoryPostProcessor</span> </span>&#123;</div><div class="line"></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">postProcessBeanFactory</span><span class="params">(ConfigurableListableBeanFactory configurableListableBeanFactory)</span> <span class="keyword">throws</span> BeansException </span>&#123;</div><div class="line">        System.out.println(TimeConvertUtil.getCurrentTime()+<span class="string">" postProcessBeanFactory has been executed"</span>);</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h2 id="applicationContext-xml"><a href="#applicationContext-xml" class="headerlink" title="applicationContext.xml"></a>applicationContext.xml</h2><figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line"><span class="php"><span class="meta">&lt;?</span>xml version=<span class="string">"1.0"</span> encoding=<span class="string">"UTF-8"</span><span class="meta">?&gt;</span></span></div><div class="line"><span class="tag">&lt;<span class="name">beans</span> <span class="attr">xmlns</span>=<span class="string">"http://www.springframework.org/schema/beans"</span></span></div><div class="line"><span class="tag">       <span class="attr">xmlns:xsi</span>=<span class="string">"http://www.w3.org/2001/XMLSchema-instance"</span></span></div><div class="line"><span class="tag">       <span class="attr">xmlns:context</span>=<span class="string">"http://www.springframework.org/schema/context"</span></span></div><div class="line"><span class="tag">       <span class="attr">xsi:schemaLocation</span>=<span class="string">"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd</span></span></div><div class="line"><span class="tag"><span class="string">        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"</span>&gt;</span></div><div class="line"></div><div class="line">    <span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">"testLoadingOrder"</span> <span class="attr">class</span>=<span class="string">"cn.net.wangshifu.TestLoadingOrder"</span> <span class="attr">init-method</span>=<span class="string">"init_method"</span> <span class="attr">destroy-method</span>=<span class="string">"destroy_method"</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">"test2"</span> <span class="attr">value</span>=<span class="string">"Test2"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;/<span class="name">bean</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">"instantiationAwareBeanPostProcessor"</span> <span class="attr">class</span>=<span class="string">"cn.net.wangshifu.MyInstantiationAwareBeanPostProcessor"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">"myBeanPostProcessor"</span> <span class="attr">class</span>=<span class="string">"cn.net.wangshifu.MyBeanPostProcessor"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">"myBeanFactoryPostProcessor"</span> <span class="attr">class</span>=<span class="string">"cn.net.wangshifu.MyBeanFactoryPostProcessor"</span>/&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">context:component-scan</span> <span class="attr">base-package</span>=<span class="string">"cn.net.wangshifu"</span>/&gt;</span></div><div class="line"></div><div class="line"><span class="tag">&lt;/<span class="name">beans</span>&gt;</span></div></pre></td></tr></table></figure>
<h2 id="测试类"><a href="#测试类" class="headerlink" title="测试类"></a>测试类</h2><figure class="highlight d"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">package</span> cn.net.wangshifu;</div><div class="line"></div><div class="line"><span class="keyword">import</span> org.springframework.context.ApplicationContext;</div><div class="line"><span class="keyword">import</span> org.springframework.context.support.ClassPathXmlApplicationContext;</div><div class="line"></div><div class="line"><span class="keyword">public</span> <span class="keyword">class</span> Main &#123;</div><div class="line"></div><div class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> main(String[] args) &#123;</div><div class="line">        ApplicationContext applicationContext = <span class="keyword">new</span> ClassPathXmlApplicationContext(<span class="string">"applicationContext.xml"</span>);</div><div class="line">        TestLoadingOrder testLoadingOrder = (TestLoadingOrder) applicationContext.getBean(<span class="string">"testLoadingOrder"</span>);</div><div class="line">        System.<span class="keyword">out</span>.println(<span class="string">"test1: "</span> + TestLoadingOrder.getTest1());</div><div class="line">        System.<span class="keyword">out</span>.println(<span class="string">"test2: "</span> + testLoadingOrder.getTest2());</div><div class="line">        ((ClassPathXmlApplicationContext)applicationContext).registerShutdownHook();</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h2 id="运行结果"><a href="#运行结果" class="headerlink" title="运行结果"></a>运行结果</h2><figure class="highlight less"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div></pre></td><td class="code"><pre><div class="line">八月 <span class="selector-tag">28</span>, <span class="selector-tag">2017</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:06</span> 上午 <span class="selector-tag">org</span><span class="selector-class">.springframework</span><span class="selector-class">.context</span><span class="selector-class">.support</span><span class="selector-class">.ClassPathXmlApplicationContext</span> <span class="selector-tag">prepareRefresh</span></div><div class="line">信息: <span class="selector-tag">Refreshing</span> <span class="selector-tag">org</span><span class="selector-class">.springframework</span><span class="selector-class">.context</span><span class="selector-class">.support</span><span class="selector-class">.ClassPathXmlApplicationContext</span>@<span class="selector-tag">685f4c2e</span>: <span class="selector-tag">startup</span> <span class="selector-tag">date</span> <span class="selector-attr">[Mon Aug 28 10:40:06 CST 2017]</span>; <span class="selector-tag">root</span> <span class="selector-tag">of</span> <span class="selector-tag">context</span> <span class="selector-tag">hierarchy</span></div><div class="line">八月 <span class="selector-tag">28</span>, <span class="selector-tag">2017</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:06</span> 上午 <span class="selector-tag">org</span><span class="selector-class">.springframework</span><span class="selector-class">.beans</span><span class="selector-class">.factory</span><span class="selector-class">.xml</span><span class="selector-class">.XmlBeanDefinitionReader</span> <span class="selector-tag">loadBeanDefinitions</span></div><div class="line">信息: <span class="selector-tag">Loading</span> <span class="selector-tag">XML</span> <span class="selector-tag">bean</span> <span class="selector-tag">definitions</span> <span class="selector-tag">from</span> <span class="selector-tag">class</span> <span class="selector-tag">path</span> <span class="selector-tag">resource</span> <span class="selector-attr">[applicationContext.xml]</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:037</span> <span class="selector-tag">postProcessBeanFactory</span> <span class="selector-tag">has</span> <span class="selector-tag">been</span> <span class="selector-tag">executed</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:078</span> <span class="selector-tag">InstantiationAwareBeanPostProcessor</span><span class="selector-class">.postProcessBeforeInstantiation</span>: <span class="selector-tag">testLoadingOrder</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:081</span> <span class="selector-tag">TestLoadingOrder</span><span class="selector-class">.static</span> <span class="selector-tag">has</span> <span class="selector-tag">been</span> <span class="selector-tag">executed</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:082</span> <span class="selector-tag">TestLoadingOrder</span><span class="selector-class">.construct</span> <span class="selector-tag">has</span> <span class="selector-tag">been</span> <span class="selector-tag">executed</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:089</span> <span class="selector-tag">InstantiationAwareBeanPostProcessor</span><span class="selector-class">.postProcessAfterInstantiation</span>: <span class="selector-tag">testLoadingOrder</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:089</span> <span class="selector-tag">InstantiationAwareBeanPostProcessor</span><span class="selector-class">.postProcessBeforeInitialization</span>: <span class="selector-tag">testLoadingOrder</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:089</span> <span class="selector-tag">BeanPostProcessor</span><span class="selector-class">.postProcessBeforeInitialization</span> <span class="selector-pseudo">:class</span> <span class="selector-tag">cn</span><span class="selector-class">.net</span><span class="selector-class">.wangshifu</span><span class="selector-class">.TestLoadingOrder</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:089</span> <span class="selector-tag">TestLoadingOrder</span><span class="selector-class">.postConstruct</span> <span class="selector-tag">has</span> <span class="selector-tag">been</span> <span class="selector-tag">executed</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:090</span> <span class="selector-tag">TestLoadingOrder</span><span class="selector-class">.afterProSertiesSet</span> <span class="selector-tag">has</span> <span class="selector-tag">been</span> <span class="selector-tag">executed</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:090</span> <span class="selector-tag">TestLoadingOrder</span><span class="selector-class">.init_method</span> <span class="selector-tag">has</span> <span class="selector-tag">been</span> <span class="selector-tag">executed</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:090</span> <span class="selector-tag">InstantiationAwareBeanPostProcessor</span><span class="selector-class">.postProcessAfterInitialization</span>: <span class="selector-tag">testLoadingOrder</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:090</span> <span class="selector-tag">BeanPostProcessor</span><span class="selector-class">.postProcessAfterInitialization</span> <span class="selector-pseudo">:class</span> <span class="selector-tag">cn</span><span class="selector-class">.net</span><span class="selector-class">.wangshifu</span><span class="selector-class">.TestLoadingOrder</span></div><div class="line"><span class="selector-tag">test1</span>: <span class="selector-tag">static</span></div><div class="line"><span class="selector-tag">test2</span>: <span class="selector-tag">null</span></div><div class="line">八月 <span class="selector-tag">28</span>, <span class="selector-tag">2017</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span> 上午 <span class="selector-tag">org</span><span class="selector-class">.springframework</span><span class="selector-class">.context</span><span class="selector-class">.support</span><span class="selector-class">.ClassPathXmlApplicationContext</span> <span class="selector-tag">doClose</span></div><div class="line">信息: <span class="selector-tag">Closing</span> <span class="selector-tag">org</span><span class="selector-class">.springframework</span><span class="selector-class">.context</span><span class="selector-class">.support</span><span class="selector-class">.ClassPathXmlApplicationContext</span>@<span class="selector-tag">685f4c2e</span>: <span class="selector-tag">startup</span> <span class="selector-tag">date</span> <span class="selector-attr">[Mon Aug 28 10:40:06 CST 2017]</span>; <span class="selector-tag">root</span> <span class="selector-tag">of</span> <span class="selector-tag">context</span> <span class="selector-tag">hierarchy</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:132</span> <span class="selector-tag">TestLoadingOrder</span><span class="selector-class">.destory</span> <span class="selector-tag">has</span> <span class="selector-tag">been</span> <span class="selector-tag">executed</span></div><div class="line"><span class="selector-tag">2017-08-28</span> <span class="selector-tag">10</span><span class="selector-pseudo">:40</span><span class="selector-pseudo">:07</span><span class="selector-pseudo">:132</span> <span class="selector-tag">TestLoadingOrder</span><span class="selector-class">.destory_method</span> <span class="selector-tag">has</span> <span class="selector-tag">been</span> <span class="selector-tag">executed</span></div></pre></td></tr></table></figure>

      
    </div>

    
	
	<div>
      
      <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>
      
    </div>

    
    
    
	
    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wechatpay.jpg" alt="王宇 微信支付"/>
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/alipay.jpg" alt="王宇 支付宝"/>
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    
      <div>
        <ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>王宇</li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://wyu.space/2017/08/25/Spring Bean的加载过程/" title="Spring Bean的加载过程">http://wyu.space/2017/08/25/Spring Bean的加载过程/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明出处！</li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Spring/" rel="tag"><i class="fa fa-tag"></i> Spring</a>
          
            <a href="/tags/Bean/" rel="tag"><i class="fa fa-tag"></i> Bean</a>
          
        </div>
      

      
      
        <div class="post-widgets">
        

        

        
          
          <div id="needsharebutton-postbottom">
            <span class="btn">
              <i class="fa fa-share-alt" aria-hidden="true"></i>
            </span>
          </div>
        
        </div>
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/08/25/字符串的最长不重复子串/" rel="next" title="字符串的最长不重复子串">
                <i class="fa fa-chevron-left"></i> 字符串的最长不重复子串
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/05/02/MySQL相关知识点/" rel="prev" title="MySQL相关知识点">
                MySQL相关知识点 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          

  
    <div class="comments" id="comments">
      <div id="lv-container" data-id="city" data-uid="MTAyMC8zNjE0NS8xMjY4MA=="></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/avatar.jpg"
                alt="王宇" />
            
              <p class="site-author-name" itemprop="name">王宇</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">10</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">7</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">18</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          

          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                友情链接
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="http://wangshifu.net.cn" title="Wong" target="_blank">Wong</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://pvitlzp.cn" title="刘志鹏" target="_blank">刘志鹏</a>
                  </li>
                
              </ul>
            </div>
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#获取当前时间的工具类"><span class="nav-number">1.</span> <span class="nav-text">获取当前时间的工具类</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#测试Bean"><span class="nav-number">2.</span> <span class="nav-text">测试Bean</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#InstantiationAwareBeanPostProcessor的实现类"><span class="nav-number">3.</span> <span class="nav-text">InstantiationAwareBeanPostProcessor的实现类</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#BeanPostProcessor的实现类"><span class="nav-number">4.</span> <span class="nav-text">BeanPostProcessor的实现类</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#BeanFactoryPostProcessor的实现类"><span class="nav-number">5.</span> <span class="nav-text">BeanFactoryPostProcessor的实现类</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#applicationContext-xml"><span class="nav-number">6.</span> <span class="nav-text">applicationContext.xml</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#测试类"><span class="nav-number">7.</span> <span class="nav-text">测试类</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#运行结果"><span class="nav-number">8.</span> <span class="nav-text">运行结果</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

<div class="copyright">&copy; 2017 &mdash; <span itemprop="copyrightYear">2018</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">王宇</span>

  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    
      <span class="post-meta-item-text">站点总字数：</span>
    
    <span title="站点总字数">29k</span>
  

  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    
      <span class="post-meta-item-text">站点阅读时长 &asymp;</span>
    
    <span title="站点阅读时长">26 分钟</span>
  
</div>




  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动 v3.3.8</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/theme-next/hexo-theme-next">NexT.Mist</a> v6.2.0</div>



        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv" title="总访客量">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="site-pv" title="总访问量">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
      <div id="needsharebutton-float">
        <span class="btn">
          <i class="fa fa-share-alt" aria-hidden="true"></i>
        </span>
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>














  











  



  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/reading_progress/reading_progress.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.2.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.2.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.2.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.2.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.2.0"></script>



  



	





  





  
    <script type="text/javascript">
      (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
      })(document, 'script');
    </script>
  










  




  
  
  
  <link rel="stylesheet" href="/lib/algolia-instant-search/instantsearch.min.css">

  
  
  <script src="/lib/algolia-instant-search/instantsearch.min.js"></script>
  

  <script src="/js/src/algolia-search.js?v=6.2.0"></script>



  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

  
  
  
  <script src="/lib/needsharebutton/needsharebutton.js"></script>

  <script>
    
      pbOptions = {};
      
          pbOptions.iconStyle = "box";
      
          pbOptions.boxForm = "horizontal";
      
          pbOptions.position = "bottomCenter";
      
          pbOptions.networks = "Weibo,Wechat,Douban,QQZone,Twitter,Facebook";
      
      new needShareButton('#needsharebutton-postbottom', pbOptions);
    
    
      flOptions = {};
      
          flOptions.iconStyle = "box";
      
          flOptions.boxForm = "horizontal";
      
          flOptions.position = "bottomLeft";
      
          flOptions.networks = "Weibo,Wechat,Douban,QQZone,Twitter,Facebook";
      
      new needShareButton('#needsharebutton-float', flOptions);
    
  </script>

  

  

  

  

  
  
  
  <script src="/lib/bookmark/bookmark.min.js?v=1.0"></script>
  <script type="text/javascript">
  
    bookmark.scrollToMark('auto', "#更多");
  
  </script>


  

  
  <!-- 页面点击小红心 -->
  <script type="text/javascript" src="/js/src/love.js"></script>
</body>
</html>
